﻿using Unity.Burst;
using Unity.Entities;
using UnityEngine;


public partial struct DestroyGameObjectSystem : ISystem
{
    [BurstCompile]
    public void OnCreate(ref SystemState state)
    {
        state.RequireForUpdate<BattleSceneTag>();
    }

    public void OnUpdate(ref SystemState state)
    {

        //销毁GameObject
        foreach (var transAsyncInfo in SystemAPI.Query<TransAsyncInfo>().WithAll<PoolReceiveTag>())
        {
            //实际项目中，请调用对应的数据池处理
            Object.Destroy(transAsyncInfo.Trans.Value.gameObject);
        }

    }

}